import java.io.*;
import java.util.*;
import java.security.*;

public class Utils
{
	public static String ByteToString(byte[] block) throws Exception
	{
		return new String(block, "UTF8");
	}
	
	public static String ByteToBitString(byte[] b)
	{
		String binary = "";
		for (int i = 0; i < b.length; i++)
		{
			String separator = " ";
			if (i == 0) 
				separator = "";
				
			binary = binary + separator + Integer.toBinaryString(b[i] & 0xFF);
		}
		return binary;
	}
	
	public static String GetUserInput(String display) throws Exception
	{
		InputStreamReader inStream = new InputStreamReader(System.in);
		BufferedReader in = new BufferedReader(inStream);
		System.out.print(display);    
		return in.readLine();
	}
	
	public static String ToHexString(byte[] ba) 
	{
		StringBuilder str = new StringBuilder();
		for(int i = 0; i < ba.length; i++)
			str.append(String.format("%x", ba[i]));
		return str.toString();
	}
	
	public static byte[] GetIV(String iv) throws Exception
	{
		MessageDigest md = MessageDigest.getInstance("MD5");
		return Arrays.copyOfRange(md.digest(iv.getBytes()), 0, 8);
	}
}













